<?php
use Application\Model\vn3dUtil;
$this->headtitle($product->name);
?>
<style>
#vn3d-banner img {
	width: 100%;
}

#vn3d-banner {
	padding-left: 0px !important;
	padding-right: 0px !important;
}

#vn3d-detail-product,#vn3d-addtocart {
	padding-left: 0px !important;
	padding-right: 0px !important;
}

#vn3d-img-preview img {
	height: 90px !important;
	width: 90px !important;
	margin-top: 3px;
}

#vn3d-video-preview {
	margin-top: 10px;
}

</style>
<script type="text/javascript">
var productID="<?php echo $product->id;?>";
function closeFancybox(){
	loadCart();
	$.fancybox.close();
}
function loadCart(){
	$.ajax({
        url: "/store/preview-cart/",
        type: "POST",
        dataType:"html",
        success: function(html){
        $("#vn3d-cart").html(html);

        },
        error:function(){
            console.log("AJAX request was a failure");
        }
      });
}
function loadAddtocart(){
	$.ajax({
        url: "/store/add-to-cart/"+productID,
        type: "POST",
        dataType:"html",
//	        data: {
//	               order_by:orderby,
//	               order:order,
//	        	   rowperpage:rowperpage,
//	        	   typeView:typeView
//	        	}, //The data your sending to page
        success: function(html){
        $("#inline-addtocart").html(html);
        $("#inline").click();

        setTimeout(function(){closeFancybox(); },3000);


        },
        error:function(){
            console.log("AJAX request was a failure");
        }
      });
}
$(document).ready(function(){


	$("#vn3d-add-to-cart").click(function(){
		loadAddtocart();

		});



      $(document).on("click","#vn3d-continuous",function(){
    	  closeFancybox();
          });


});

</script>
<ol class="breadcrumb">
	<li><a href="/store">Home</a></li>
	<li><a
		href="/store/products/<?php echo $menu->id;?>/<?php echo vn3dUtil::convertUrlSeo($menu->name);?>"><?php echo $menu->name;?></a></li>
	<li class="active"><a
		href="/store/products/<?php echo $groupProduct->id;?>/<?php echo vn3dUtil::convertUrlSeo($groupProduct->name);?>"><?php echo $groupProduct->name;?></a></li>
</ol>
<div>
	<hr>
	<div id="vn3d-banner" class="col-md-12 pull-left">

<?php
echo vn3dUtil::getBannerProductHtml($product);
?>
</div>
	<div id="vn3d-detail-product" class="col-md-10 pull-left">
		<div id="vn3d-img-preview">
<?php

foreach ($images as $key => $image) {
    echo vn3dUtil::getImageHtml($image);
}
?>
</div>
		<div id="vn3d-video-preview">
<?php echo $product->video;?>
</div>
		<div id="vn3d-content-preview">
<?php echo $product->desc;?>
</div>

	</div>
	<div id="vn3d-addtocart" class="col-md-2 pull-left">
		<h4><?php echo $product->name;?></h4>
		<span class="text-muted">CODE: <?php echo $product->code;?></span> <span
			class="text-primary" style="font-size: large;">$<?php echo $product->price;?>.00</span>
		<hr>
		<small>ADD TO WISH LIST</small>
		<button id="vn3d-add-to-cart" type="button"
			class="btn btn-xs btn-danger">ADD TO CART</button>
		<a id="inline" href="#inline-addtocart" style="display: none;">add to
			cart</a>

	</div>

</div>
<div style="display: none;" id="inline-addtocart">add to cart</div>
